import './utils/utils'
import './utils/http'
App({
  // 应用启动的时候 调用函数
  onLaunch() {
    // 获取token
    this.getToken()
    this.getRefreshToken()
  },

  getToken() {
    // 读取本地存储中token
    const token = wx.getStorageSync('token')
    // 设置到  应用实例上
    this.token = token
    // 返回token
    return token
  },
  getRefreshToken() {
    // 读取本地存储中 token
    const refreshToken = wx.getStorageSync('refreshToken')
    // 设置到  应用实例上
    this.refreshToken = refreshToken
    // 返回token
    return refreshToken
  },
  setToken(token, refreshToken) {
    wx.setStorageSync('token', token)
    wx.setStorageSync('refreshToken', refreshToken)
    this.token = token
    this.refreshToken = refreshToken
  },
})
